﻿<?xml version="1.0" encoding="utf-8"?>
<Databases>
	<Database Type="SQL">
		<ConnectionString conn1="Driver={SQL Server};Server={0};" conn2="Driver={SQL Server};Server={0};Database={1}"/>
		<Tables>
			<Table Name="AttributeTable" SQL="CREATE TABLE [dbo].[AttributeValueMap]([variableName] [nvarchar](MAX) NOT NULL, [attribname] [nvarchar](MAX) NOT NULL, [attribval] [nvarchar](MAX) NOT NULL)"/>
			<Table Name="DimensionTable" SQL="CREATE TABLE [dbo].[{0}]([dmindex] [int] NOT NULL, [dmvalue] [{1}] NOT NULL)"/>
      <Table Name="DimensionalityTable" SQL="CREATE TABLE [dbo].[DimensionalityMap]([variableName] [nvarchar](MAX) NOT NULL,[bitValue] [int] NOT NULL)" />
      <Table Name="HyperCubeDataTable" SQL="CREATE TABLE [dbo].[HyperCubeDataTable]([xindex] [int] NOT NULL, [yindex] [int] NOT NULL,[zindex] [int] NOT NULL, [tindex] [int] NOT NULL,">
				<Suffix Id="1" SQL="[{0}] [{1}],"/>
			</Table>
		</Tables>
    <Procedures>
      <Procedure Name="InsertHyperCubeData" SQL="CREATE PROCEDURE [dbo].[InsertHyperCubeData] {0} AS BEGIN SET NOCOUNT ON INSERT INTO [HyperCubeDataTable] ({1}) VALUES({2}) END" />
    </Procedures>
		<Types>
			<Type NcType="System.Byte" DBType="smallint" />
			<Type NcType="System.Int16" DBType="smallint" />
			<Type NcType="System.Int32" DBType="int" />
			<Type NcType="System.Single" DBType="real" />
			<Type NcType="System.Double" DBType="float" />
			<Type NcType="char" DBType="VarChar" />
		</Types>
		<Queries>
			<Query Name="CreateDB" SQL="Create Database {0}" />
			<Query Name="InsertDimValues" SQL="insert into {0} (dmindex,dmvalue) " >
				<Suffix Id="1" SQL="select {0},{1} union all "/>
				<Suffix Id="End" SQL="select {0},{1}"/>
			</Query>
			<Query Name="InsertAttribValues" SQL="insert into AttributeValueMap (variableName,attribname,attribval) " >
				<Suffix Id="1" SQL="select '{0}','{1}','{2}' union all "/>
				<Suffix Id="End" SQL="select '{0}','{1}','{2}'"/>
			</Query>
			<Query Name="InsertDataValues" SQL="insert into HyperCubeDataTable (xIndex,yIndex,zIndex,tIndex,{0}) values({1})" />
      <Query Name="InsertDimensionality" SQL="insert into DimensionalityMap (variableName,bitValue) values('{0}',{1})" />
		</Queries>
	</Database>
</Databases>
	
